//
//  Rectangle.m
//  Prog8.5
//
//  Created by Nenad Djordjevic on 6/7/09.
//  Copyright 2009 USS. All rights reserved.
//

#import "Rectangle.h"

@implementation Rectangle

@synthesize width, height;

-(void) setWidth: (int) w andHeight: (int) h
{
	width = w;
	height = h;
}

-(void) setOrigin: (XYPoint *) pt
{
	if (origin)
		[origin release];
	
	origin = [[XYPoint alloc] init];
	[origin setX: pt.x andY: pt.y];
}

-(int) area
{
	return width * height;
}

-(int) perimeter
{
	return (width + height) * 2;
}

-(XYPoint *) origin
{
	return origin;
}

-(void) dealloc
{
	[origin release];
	[super dealloc];
}
@end
